/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx.servlet;

import com.wf.captcha.GifCaptcha;
import com.wf.captcha.utils.CaptchaUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * <p>Project: app2022 - Checks
 * <p>Powered by webrx On 2022-01-25 14:28:32
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@WebServlet("/checks")
public class Checks extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        GifCaptcha c = new GifCaptcha();
        //c.out(resp.getOutputStream());
        //直接输出到servlet上，并将验证码的内容保存到session session.setAttribute("captcha",c.text());
        CaptchaUtil.out(c, req, resp);

        /*
        HttpSession session = req.getSession();
        Enumeration<String> e = session.getAttributeNames();
        while (e.hasMoreElements()) {
            String n = e.nextElement();
            System.out.println(n);
            System.out.println(session.getAttribute(n));
        }

         */

    }
}
